<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=3, minimum-scale=1, user-scalable=no">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
    <meta http-equiv="expires" content="0">
    <!-- BEGIN 全局样式 -->
    <link rel="stylesheet" href="../../../lib/bootstrap-3.3.7-dist/css/bootstrap.min.css" type="text/css"/>
    <link rel="stylesheet" href="../../../css/reset-diy.css" type="text/css">
    <title></title>
</head>
<body>
<div class="container-fluid pt-20">
    请设置 title
</div>

<!--核心脚本sss-->
<script src="../../lib/jquery/1.9.1/jquery.js" type="text/javascript" charset="utf-8"></script>
<!--[if lt IE 9]>
<script src="../../js/excanvas.min.js"></script>
<script src="../../js/respond.min.js"></script>
<![endif]-->
<!--加密插件sss 必须放在jquery.myPlugIn_v1.0.js前面-->
<script src="../../js/common/jsrsasign-all-min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/common/crypto-js.min.js" type="text/javascript" charset="utf-8"></script>
<!--加密插件eee-->

<!--<script src="../../js/bootstrap.min.js" type="text/javascript"></script>-->
<!--<script src="../../js/jquery.cookie.min.js" type="text/javascript"></script>-->
<!--<script src="../../lib/layer/2.4/layer.js" type="text/javascript" charset="utf-8"></script>-->
<!--<script src="../../lib/laypage/1.2/laypage.js" type="text/javascript" charset="utf-8"></script>-->
<script src="../../js/work-box.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/common/jquery.myPlugIn_v1.0.js" type="text/javascript" charset="utf-8"></script>


<!--<script src="../../js/common/localstorage-ie.js" type="text/javascript" charset="utf-8"></script>-->
<!--<script src="../../js/jquery.slimscroll.min.js" type="text/javascript"></script>-->
<!--<script src="../../js/jquery.blockui.min.js" type="text/javascript"></script>-->
<!--<script src="../../js/jquery.uniform.min.js" type="text/javascript"></script>-->
<script>
    jQuery(document).ready(function () {
        function Test() {
            this.clickEvent();
            this.getData();
        }

        Test.prototype = {
            init:function (){

            },
            clickEvent: function () {

            },
            // 分页
            getData: function () {
                var _this = this;
                _this.dataVessel.text("正在获取数据...");

                var url, param, method;
                url = url_join("warning/list");
                method = "post";
                param = {};

                T.ajaxPaging(url, method, param, function (res) {
                    var data = typeof res == "object" ? res.data : [];

                    if (data.items.length > 0) {
                        _this.render(data);
                        _this.dataVessel.text("");

                        T.pagingAll(
                            {
                                bar: 'paging-bar',
                                sum: data.total_pages,
                                callback: function (obj) {
                                    param.page = obj.curr;
                                    T.ajaxSecret(url, method, param, function (res) {
                                        var data = res.data;
                                        _this.dataVessel.text("");
                                        if (data.items.length > 0) {
                                            _this.render(data);
                                        } else if (data.items.length == 0) {
                                            _this.dataVessel.text("没有找到相关数据..");
                                        }
                                    });
                                },
                            }
                        );
                    } else if (data.items.length == 0) {
                        $("#paging-bar").hide();
                        _this.dataVessel.text("没有找到相关数据..");
                    }
                });
            },
            render: function (data) {
                var _this = this;
                var vessel = $("#table tbody");
                vessel.html("");
                if (data.length > 0) {
                    $.each(data, function (i, v) {
                        var tr = $(
                            '<tr>' +
                            '<td>' + v.username + '</td>' +
                            '<td>' + (v.group_names || "无") + '</td>' +
                            '<td>' + _this.statusText + '</td>' +
                            '<td>' + (v.leave_at || "未打卡") + '</td>' +
                            '<td>' + (v.work_at || "未打卡") + '</td>' +
                            '</tr>'
                        );
                        vessel.append(tr);
                    });
                } else {
                    // $("#paging-bar").hide();
                    vessel.append("<tr><td colspan='5' class='f-20'>没有找到相关数据..</td></tr>");
                }
            },
            submitEvent: function () {
                var _this = this;
                $("#table-device").on("click",".btn-reset",function (){
                    var id = $(this).data("id");
                    T.ajaxSecret(url_join(createData),"post",{},function (res){

                    });
                });
            },
        };
        new Test();
    });
</script>
</body>
</html>